<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    // 原型链实现继承
    // 既可以继承构造函数上面的方法，也可继承构造函数原型链上面的方法
    // 缺点是无法给实例化的子类传参   var w = new Web('xiaohui',20)
    function Person(){
        this.name = 'xiaohui'
        this.age = 20
        this.run = function(){
            console.log(this.name + '在运动');
        }
    }

    Person.prototype.sex = 'boy'
    Person.prototype.work = function(){
        console.log(this.name + '在工作');
    }

    function Web(){}
    Web.prototype = new Person()
</script>
</html>